<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_produce_plan" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 设置开始时间 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="开始日期" prop="plan_produce_begin_date">
              <el-input v-model="s_produce_plan.plan_produce_begin_date" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="开始时间" prop="hours">
              <el-select style='width:100%' v-model="s_produce_plan.hours">
                <el-option label="1" value="1" />
                <el-option label="2" value="2" />
                <el-option label="3" value="3" />
                <el-option label="4" value="4" />
                <el-option label="5" value="5" />
                <el-option label="6" value="6" />
                <el-option label="7" value="7" />
                <el-option label="8" value="8" />
                <el-option label="9" value="9" />
                <el-option label="10" value="10" />
                <el-option label="11" value="11" />
                <el-option label="12" value="12" />
                <el-option label="13" value="13" />
                <el-option label="14" value="14" />
                <el-option label="15" value="15" />
                <el-option label="16" value="16" />
                <el-option label="17" value="17" />
                <el-option label="18" value="18" />
                <el-option label="19" value="19" />
                <el-option label="20" value="20" />
                <el-option label="21" value="21" />
                <el-option label="22" value="22" />
                <el-option label="23" value="23" />
                <el-option label="24" value="24" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="appointBeginTimeSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
      <el-button @click="gotoPage('/mes/produce/flow/CartogramProductionPlan?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'AppointBeginTime',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_produce_plan: {
          plan_produce_begin_date: null,
          hours: null,
        },
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/produce/flow/ProducePlan/appointBeginTime?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      appointBeginTimeSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/mes/produce/flow/ProducePlan/appointBeginTimeSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/mes/produce/flow/AppointOneBTime?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
    },
  }
</script>
